<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定位</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        div {
            margin: 20px;
            padding: 10px;
        }

        .box {
            height: 400px;
            border: 1px solid blue;
            position: relative;
            top: 0;
            left: 0;
        }

        .box1 {
            border: 1px solid green;
            position: absolute;
            top: 150px;
            left: 200px;
        }

        .box2 {
            border: 1px solid red;
            position: relative;
          
        }

        .box3 {
            border: 1px solid blueviolet;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="box1">盒子一</div>
        <div class="box2">盒子二</div>
        <div class="box3">盒子三</div>
    </div>
</body>

</html>